import 'package:boss/ui/page/necessaryOrder/page/necessaryOrderDetail/provider/necessary_order_detail_provider.dart';
import 'package:boss/provider/necessary_order_provider.dart';
import 'package:boss/ui/widget/button/fixed_bottom_btn.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'necessary_order_detail_form.dart';

class NecessaryOrderDetailBrowser extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          NecessaryOrderDetailForm(),
          FixedBottomBtn(
            title: '保 存',
            onTap: () {
              var necessaryOrderDetailProvider = Provider.of<NecessaryOrderDetailProvider>(
                context,
                listen: false,
              );

              var necessaryOrderProvider = Provider.of<NecessaryOrderProvider>(
                context,
                listen: false,
              );

              necessaryOrderProvider.addOrUpdateNecessaryOrder(necessaryOrderDetailProvider.data);
            },
          )
        ],
      ),
    );
  }
}
